import com.lyy.entity.Video;
import com.lyy.MyBatisUtil;
import org.apache.ibatis.session.SqlSession;
import org.junit.Test;

import java.util.Date;

/**
 * @author Liangyaoyun
 */
public class VideoMapper {
    @Test
    public void insertTest(){
        SqlSession sqlSession = MyBatisUtil.getFactory("mybatis.xml").openSession();
        VideoMapper mapper = sqlSession.getMapper(VideoMapper.class);
        Video video=new Video();
        video.setVideoId(1);
        video.setVideoDeleted(0);
        video.setVideoTitle("第一集");
        video.setVideoInfo("五十万");
        video.setAuthor("梁耀云");
        video.setCoverImage("你好");
        video.setPrice(5000000.0);
        video.setCreateTime(new Date());
        video.setModifyTime(new Date());
        video.setStar(50);
        video.setSummaryImage("初见");
        sqlSession.commit();
        sqlSession.close();
    }
    @Test
    public void updateTest(){
        SqlSession sqlSession = MyBatisUtil.getFactory("mybatis.xml").openSession();
        VideoMapper mapper = sqlSession.getMapper(VideoMapper.class);
        Video video=new Video();
        sqlSession.commit();
        sqlSession.close();
    }
    @Test
    public void selectTest(){
        SqlSession sqlSession = MyBatisUtil.getFactory("mybatis.xml").openSession();
        VideoMapper mapper = sqlSession.getMapper(VideoMapper.class);
        Video video=new Video();
        sqlSession.commit();
        sqlSession.close();
    }
    @Test
    public void deleteTest(){
        SqlSession sqlSession = MyBatisUtil.getFactory("mybatis.xml").openSession();
        VideoMapper mapper = sqlSession.getMapper(VideoMapper.class);
        Video video=new Video();
        sqlSession.commit();
        sqlSession.close();
    }
}
